import 'package:flutter/material.dart';

class RightListWidget extends StatefulWidget {
  final String title;
  final List<String> list;
  const RightListWidget({Key key, this.title, this.list}) : super(key: key);

  @override
  _RightListWidgetState createState() => _RightListWidgetState();
}

class _RightListWidgetState extends State<RightListWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      margin: EdgeInsets.all(20),
      padding: EdgeInsets.all(20),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.all(
          Radius.circular(10),
        ),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text("${widget.title}"),
          Container(
            margin: EdgeInsets.only(top: 10),
            padding: EdgeInsets.only(
              left: 10,
              right: 10,
            ),
            child: ListView(
                // 包裹子widget
                shrinkWrap: true,
                children: [
                  ...widget.list.map(
                    (e) => ListTile(
                      title: Text("$e"),
                    ),
                  )
                ]),
          ),
        ],
      ),
    );
  }
}
